set rawstr=%1
set str=%rawstr:.c=%
if exist %str%.o goto compare_mtime
goto do_compile
goto end


:compare_mtime
REM mcmp is a C program that will compare modification times.
REM If output file mtime is older than input file mtime then compilation is required
REM mcmp returns 2 when above condition is satisfied.
mcmp %str%.o %1
if %ERRORLEVEL%==2 goto do_compile
goto end

:do_compile
echo %str%.o
%CC% %CFLAGS% -c -o %str%.o %1

:end